import React, { render, Component } from './react';

class Greating extends Component {
  constructor(props) {
    super(props);
    this.state = {
      name: '王蓝胖'
    }
  }

  render() {
    return (
      <div>
        <div>我是{this.props.name}！</div>
        <div>{this.state.name}</div>
        <button onClick={() => this.setState({ name: '王王王' })}>button</button>
      </div>
    )
  }
}

function Alert(props) {
  return <div>{props.title}函数组件</div>
}

const jsx = (<div>
  <div>
    <p>hello lanpang</p>
    <p>hello react</p>
  </div>
  <p>lanpang 6666666</p>
  <Greating name="王蓝胖" />
  <Alert title="hello" />
</div>);
const root = document.querySelector('#root');

render(<Greating name="王蓝胖" />, root);

// setTimeout(() => {
//   render(<Greating name="王蓝胖" />, root);
// }, 2000);